	//
	//  JsRequestBaseData.m
	//  DuTe
	//
	//  Created by Gikki Ares on 2020/12/31.
	//  Copyright © 2020 vgemv. All rights reserved.
	//

#import "JsRequestBaseData.h"
#import "JsYy_Model.h"
@implementation JsRequestBaseData

@end

@implementation JsRequestInfo

- (instancetype)init {
	if(self = [super init]){
		self.requestStartTime = CFAbsoluteTimeGetCurrent();
	}
	return self;
}

-(NSString *)toString {
	NSMutableString * mstrDetail = [NSMutableString string];
	[mstrDetail appendString:@"\n\n\n========RequestInfoStart========\n"];
	//1.0 请求地址
	[mstrDetail appendFormat:@"RequestURL:%@\n",_urlString];
	
	//1.2 请求方式,参数和返回值.
	[mstrDetail appendFormat:@"RequestMethod:%@\n",_methodName];

	//1.3 RequestHeader
	[mstrDetail appendFormat:@"RequestHeader:%@\n",[_requestHeader jsyy_modelToJSONString]];
	//RequestBody
	[mstrDetail appendFormat:@"ReqeustBody:%@\n",_requestBodyInputString];
	
	//ResponseState:
	[mstrDetail appendFormat:@"ResponseStatus:%ld\n",_responseStateCode];
	
	
	{
			//response header;
		NSString * str = @"None";
		if(_responseHeader.allKeys.count) {
			str = [_responseHeader jsyy_modelToJSONString];
			[mstrDetail appendFormat:@"ResponseHeader:%@\n",str];
		}
		
	}
	[mstrDetail appendFormat:@"ResponseBody:%@\n",_responseBodyOutputString];
	
	if(_responseStateCode != JsResponseStateOk){
		[mstrDetail appendFormat:@"错误信息:%@\n",_responseStateMessage];
	}
	CFAbsoluteTime requestUsedTime = _requestEndTime - _requestStartTime;
	[mstrDetail appendFormat:@"接口用时:%.2f ms\n",requestUsedTime];
	[mstrDetail appendFormat:@"========RequestInfoEnd========\n\n\n"];
	
	return mstrDetail;
}

@end
